﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace Mole
{
    public partial class FrmSettings : DockContent
    {
        public DockPanel _dockPanelMain;

        public FrmSettings()
        {
            InitializeComponent();

            rbRecursive0.CheckedChanged += new EventHandler(ScanDepth);
            rbRecursive1.CheckedChanged += new EventHandler(ScanDepth);
            rbRecursive2.CheckedChanged += new EventHandler(ScanDepth);

            try
            {
                tbView.Text = Properties.Settings.Default.FILEOPEN;
                tbWGET.Text = Properties.Settings.Default.WGET;
                tbVTApi.Text = Properties.Settings.Default.AV_VirusTotal_API;
                tbZipPassword.Text = Properties.Settings.Default.ZIP_Password;
                cbCheckDNS.Checked = Properties.Settings.Default.CheckDNS;
                cbCheckURIPath.Checked = Properties.Settings.Default.CheckURIPath;
            }
            catch
            {
            }

        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Properties.Settings.Default.FILEOPEN = tbView.Text;
                Properties.Settings.Default.WGET = tbWGET.Text;
                Properties.Settings.Default.AV_VirusTotal_API = tbVTApi.Text;
                Properties.Settings.Default.ZIP_Password = tbZipPassword.Text;
                Properties.Settings.Default.CheckDNS = cbCheckDNS.Checked;
                Properties.Settings.Default.CheckURIPath = cbCheckURIPath.Checked;
                Properties.Settings.Default.Save();
                this.Close();
            }
            catch
            {
            }
        }


        private void ScanDepth(object sender, EventArgs e)
        {
            try
            {
                RadioButton rb = sender as RadioButton;
                tbWGET.Text = rb.Tag as String;
            }
            catch
            {
            }

        }

        private void linklblVTApi_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                String url = Properties.Settings.Default.AV_VirusTotal_API_Register;
                System.Diagnostics.Process.Start(url);
            }
            catch
            {
            }
        }

    }
}
